import unittest


class TestFile1(unittest.TestCase):

    # 开始仅前一次
    @classmethod
    def setUpClass(cls) -> None:
        print("t1 prepare ---------------\n")

    # 结束后仅一次
    @classmethod
    def tearDownClass(cls) -> None:
        print("t1 end ---------------\n")

    # 单个测试用例环境准备
    def setUp(self) -> None:
        print("准备t1测试资源...")

    # 单个测试结束回调
    def tearDown(self) -> None:
        print("清理t1测试资源...\n")

    def __int__(self):
        pass

    # @unittest.skipIf()
    # @unittest.skipUnless()
    def test_method1(self):
        aa = 'test_method'
        print('         测试 test_method1')
        self.assertEqual('test_method', aa)

    @unittest.skip("........................... 使用 @unittest.skip 跳过 test_method2 测试")
    def test_method2(self):
        # 和装饰器一样的效果
        # self.skipTest()
        aa = 'test_method'
        print('         测试 test_method2')
        self.assertEqual('test_method', aa)


if __name__ == '__main__':
    unittest.main(verbosity=2)
